import React from 'react';
import CommonPage from '@/components/page/CommonPage';
import { renderNumber } from '@/utils/common';

const daoName = 'CompGsz';
const importName = 'CompGsz';
const columns: API.Column[] = [
  {
    title: '导入结果',
    width: 250,
    sorter: true,
    key: 'DRJG',
    dataIndex: 'DRJG',
    dispaly: true,
    filter: false,
    export: false,
  },
  {
    title: '导入日期',
    width: 130,
    sorter: true,
    key: 'NY',
    dataIndex: 'NY',
    dispaly: true,
    filter: true,
    export: false,
  },
  {
    title: '债券简称',
    width: 180,
    sorter: true,
    dataIndex: 'ZJJC',
    key: 'ZJJC',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '客户名称',
    width: 250,
    sorter: true,
    key: 'KHMC',
    dataIndex: 'KHMC',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '现有持仓金额(万)',
    width: 160,
    sorter: true,
    key: 'XHCCJE',
    dataIndex: 'XHCCJE',
    render: (data) => renderNumber('.2f', data),
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '利润(万)',
    width: 130,
    sorter: true,
    key: 'LR',
    dataIndex: 'LR',
    render: (data) => renderNumber('.2f', data),
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '经济资本(万)',
    width: 160,
    sorter: true,
    key: 'JJZB',
    dataIndex: 'JJZB',
    render: (data) => renderNumber('.2f', data),
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '员工1',
    width: 140,
    sorter: true,
    key: 'EMNO1',
    dataIndex: 'EMNO1',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比1(%)',
    width: 120,
    sorter: true,
    key: 'ZB1',
    dataIndex: 'ZB1',
    dispaly: true,
    //filter: true,
    export: true,
  },
  {
    title: '员工2',
    width: 100,
    sorter: true,
    key: 'EMNO2',
    dataIndex: 'EMNO2',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比2(%)',
    width: 100,
    sorter: true,
    key: 'ZB2',
    dataIndex: 'ZB2',
    dispaly: true,
    //filter: true,
    export: true,
  },
  {
    title: '员工3',
    width: 100,
    sorter: true,
    key: 'EMNO3',
    dataIndex: 'EMNO3',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比3(%)',
    width: 100,
    sorter: true,
    key: 'ZB3',
    dataIndex: 'ZB3',
    dispaly: true,
    //filter: true,
    export: true,
  },
  {
    title: '员工4',
    width: 100,
    sorter: true,
    key: 'EMNO4',
    dataIndex: 'EMNO4',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比4(%)',
    width: 100,
    sorter: true,
    key: 'ZB4',
    dataIndex: 'ZB4',
    dispaly: true,
    //filter: true,
    export: true,
  },
  {
    title: '员工5',
    width: 100,
    sorter: true,
    key: 'EMNO5',
    dataIndex: 'EMNO5',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '占比5(%)',
    width: 100,
    sorter: true,
    key: 'ZB5',
    dataIndex: 'ZB5',
    dispaly: true,
    //filter: true,
    export: true,
  },
];
const controls: API.Control[] = [
  {
    name: 'NY',
    rules: [
      { required: true, message: '按YYYYMM格式输入,例如:202201' },
      { min: 6, max: 6, message: '长度不能小于6，大于6' },
    ],
    type: 'text',
    label: '日期',
    grid: 12 / 24,
  },
  {
    name: 'ZJJC',
    //rules: [{ required: true, message: '不能为空' }],
    type: 'text',
    label: '债券简称',
    grid: 12 / 24,
  },
  {
    name: 'KHMC',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    label: '客户名称',
    grid: 12 / 24,
  },
  {
    name: 'XHCCJE',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '现有持仓金额',
    grid: 12 / 24,
  },
  {
    name: 'LR',
    type: 'number',
    dataType: 'number',
    label: '利润(万)',
    grid: 12 / 24,
  },
  {
    name: 'JJZB',
    type: 'number',
    dataType: 'number',
    label: '经济资本(万)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO1',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工1',
    grid: 12 / 24,
  },
  {
    name: 'ZB1',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比1(%)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO2',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工2',
    grid: 12 / 24,
  },
  {
    name: 'ZB2',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比2(%)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO3',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工3',
    grid: 12 / 24,
  },
  {
    name: 'ZB3',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比3(%)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO4',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工4',
    grid: 12 / 24,
  },
  {
    name: 'ZB4',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比4(%)',
    grid: 12 / 24,
  },
  {
    name: 'EMNO5',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'text',
    dataType: 'string',
    label: '员工5',
    grid: 12 / 24,
  },
  {
    name: 'ZB5',
    //rules: [{ required: true, message: '不能为空，请输入0值' }],
    type: 'number',
    dataType: 'number',
    label: '占比5(%)',
    grid: 12 / 24,
  },
];

const CompGszForm: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="公司信用债导入"
      importName={importName}
      importControls={controls}
      importMode="DeleteAfterInsert"
      importParamNames={['NY']}
      importTemplateName="公司信用债导入"
      initSorter={{ FieldName: 'NY', Direction: 'DESC' }}
    />
  );
};
export default CompGszForm;
